gtkgesturesingle: Unset button/sequence if parent handle_event failed
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 17 Oct 2014 19:12:44 +0000 (21:12 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Fri, 17 Oct 2014 19:16:56 +0000 (21:16 +0200)
There are legit reasons for GtkGesture::handle_event to return FALSE,
GtkGestureSingle objects should be unsetting the current button/sequence
if that happens, in order to avoid inconsistent states.

https://bugzilla.gnome.org/show_bug.cgi?id=738591

gtk/gtkgesturesingle.c

index 367d99cf7a9abb5edbe7d0a104e841e6f9f354c4..c549e6d23dd2bc2e5107aad6aa68960d1f3175fe 100644 (file)
@@ -220,6 +220,13 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
   if (sequence == priv->current_sequence &&
       (event->type == GDK_BUTTON_RELEASE || event->type == GDK_TOUCH_END))
     priv->current_button = 0;
+  else if (!retval)
+    {
+      if (button == priv->current_button && event->type == GDK_BUTTON_PRESS)
+        priv->current_button = 0;
+      else if (sequence == priv->current_sequence && event->type == GDK_TOUCH_BEGIN)
+        priv->current_sequence = NULL;
+    }
 
   return retval;
 }